Skip to content

Update order-properties to use sort-package-json#55

Merged
JoshuaKGoldberg merged 2 commits into
michaelfaith:masterfrom
kendallgassner:order-properties-issue-31
Oct 17, 2023
Merged

Update order-properties to use sort-package-json#55
JoshuaKGoldberg merged 2 commits into
michaelfaith:masterfrom
kendallgassner:order-properties-issue-31

Conversation

@kendallgassner

Copy link
Copy Markdown
Contributor

closes: #31

What

  • Replaced the order-properties sorting algorithm to use sort-package-json.
  • Changed the type of options from an Array<string> to
{
    order?: "legacy" | "sort-package-json" | Array<string>
}
  • defaulted the sort order to legacy
  • Add additional testing to test options: "legacy" | "sort-package-json" .

Callouts

Option: order: Array<string>

Previously, any property that was not provided in the order: Array<string> collection was ignored by the sort algorithm. Now that we are using sort-package-json, a property that is not provided in the order: Array<string> will be sorted by the defaultSortOrder provided by the library.

Sort-package-json version

the latest version of sort-package-json is an esm module so I opted to use an earlier version to avoid heavy refactorign. This package can be bumped when #33 is merged.

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh! I don't know how this slipped by me - sorry for taking two weeks @kendallgassner!

Changes look great. Just a few small nits I can take care of. Will release soon. Thanks! 🚀

Person in sunglasses trying to be cool, fist bumping a fist that appears from stage right. Pixellated explosion ensues at the bump.

Comment thread docs/rules/order-properties.md Outdated
Comment thread lib/rules/sort-collections.js
@JoshuaKGoldberg

Copy link
Copy Markdown
Collaborator

Published as eslint-plugin-package-json@0.2.0.

Intentionally a different minor version than the previous 0.1.x line. I'll publish #40 and #58 in a new 0.3 line so folks can stick with this feature in case ESLint 8 support breaks them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

order-properties: consider an option for sort-package-json's order

2 participants